package itcast.service.impl;

import itcast.dao.DakaDao;
import itcast.dao.impl.DakaDaoImpl;
import itcast.domain.Daka;
import itcast.service.DakaService;

import java.util.List;

public class DakaServiceImpl implements DakaService {
    DakaDao dakaDao=new DakaDaoImpl();
    //插入打卡数据

    @Override
    public void insertdaka(Daka daka) {
        dakaDao.insertdaka(daka);
    }

    //查询打卡数据

    @Override
    public List<Daka> finddakaAll() {
        return  dakaDao.finddakadata();
    }
    //未打卡数据

    @Override
    public List<Daka> finddakafail() {
        return dakaDao.findfaildaka();
    }
    //删除打卡daka_id数据

    @Override
    public void deletedaka(String id) {
        dakaDao.deldakabyID(Integer.parseInt(id));
    }
    //删除选中数据

    @Override
    public void deldakaselect(String[] ids) {

        if(ids!=null &&  ids.length>0){
            //1.遍历数组
            for(String id :ids){
                //2.调用dao删除
                dakaDao.deldakabyID(Integer.parseInt(id));
            }
        }
    }
    //学生自身查找打卡数据

    @Override
    public Daka studentfinddaka(String id) {
        return dakaDao.studentfinddaka(id);
    }
}
